* Added $wgInvalidUsernameCharacters to disallow certain characters in
authorRyan Schmidt <skizzerz@users.mediawiki.org>
Tue, 24 Mar 2009 22:36:53 +0000 (22:36 +0000)
committerRyan Schmidt <skizzerz@users.mediawiki.org>
Tue, 24 Mar 2009 22:36:53 +0000 (22:36 +0000)
  usernames during registration (such as "@")
* Added $wgUserrightsInterwikiDelimiter to allow changing the delimiter
  used in Special:UserRights to denote the user should be searched for
  on a different database

RELEASE-NOTES
includes/DefaultSettings.php
includes/User.php
includes/specials/SpecialUserrights.php

index f32d7a6..46f7904 100644 (file)
@@ -149,7 +149,12 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   $wgTiffThumbnailType
 * Renamed two input IDs on Special:Log from 'page' and 'user' to 'mw-log-page' and
   'mw-log-user', respectively
-
+* Added $wgInvalidUsernameCharacters to disallow certain characters in
+  usernames during registration (such as "@")
+* Added $wgUserrightsInterwikiDelimiter to allow changing the delimiter
+  used in Special:UserRights to denote the user should be searched for
+  on a different database
+  
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
 * (bug 17000) Special:RevisionDelete now checks if the database is locked
index cab5edb..ff7acbe 100644 (file)
@@ -3786,3 +3786,21 @@ $wgUseTagFilter = true;
  * To enable, set to a string like 'Main Page'
  */
 $wgRedirectOnLogin = null;
+
+/**
+ * Characters to prevent during new account creations.
+ * This is used in a regular expression character class during
+ * registration (regex metacharacters like / are escaped).
+ */
+$wgInvalidUsernameCharacters = '@';
+
+/**
+ * Character used as a delimiter when testing for interwiki userrights
+ * (In Special:UserRights, it is possible to modify users on different
+ * databases if the delimiter is used, e.g. Someuser@enwiki).
+ *
+ * It is recommended that you have this delimiter in
+ * $wgInvalidUsernameCharacters above, or you will not be able to
+ * modify the user rights of those users via Special:UserRights
+ */
+$wgUserrightsInterwikiDelimiter = '@';
\ No newline at end of file
index fad1fb8..78cb5ef 100644 (file)
@@ -589,11 +589,12 @@ class User {
         * @return \bool True or false
         */
        static function isCreatableName( $name ) {
+               global $wgInvalidUsernameCharacters;
                return
                        self::isUsableName( $name ) &&
 
                        // Registration-time character blacklisting...
-                       strpos( $name, '@' ) === false;
+                       !preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, ']/' ) . ']/', $name );
        }
 
        /**
index 11fc9bd..da98375 100644 (file)
@@ -253,9 +253,9 @@ class UserrightsPage extends SpecialPage {
         * @return mixed User, UserRightsProxy, or null
         */
        function fetchUser( $username ) {
-               global $wgOut, $wgUser;
+               global $wgOut, $wgUser, $wgUserrightsInterwikiDelimiter;
 
-               $parts = explode( '@', $username );
+               $parts = explode( $wgUserrightsInterwikiDelimiter, $username );
                if( count( $parts ) < 2 ) {
                        $name = trim( $username );
                        $database = '';